home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_tem_tiki1door.cog < prev    next >
Text File  |  1999-11-15  |  14KB  |  518 lines

  1. # Jones 3D Cog Script
  2. #
  3. # TEM_Tiki1Door.cog
  4. #
  5. # tikikey = 53
  6. #
  7. # [TRM]
  8. #
  9. # (C) 1999 LucasArts Entertainment Co. All Rights Reserved
  10. # ========================================================================================
  11.  
  12. symbols
  13.  
  14.     message     startup
  15.     message     entered
  16.     message     exited
  17.     message     activated
  18.     
  19.     thing       player          local
  20.     thing       tiki            local
  21.     thing       door            linkID=1
  22.     thing       tiki1Ghost
  23.     thing       camera          
  24.     thing       camera2
  25.     thing       camTarget       
  26.     thing       indy
  27.     thing       target1
  28.     thing       target2
  29.     thing       target3
  30.     thing       spot0Offset
  31.     thing       spot1Offset
  32.     thing       t_Monkey        # stupid monkey
  33.     
  34.     # ** spiders **
  35.     thing       spider0
  36.     thing       spider1
  37.     
  38.     # on spot surfaces
  39.     surface     spot0           linkID=2
  40.     surface     spot1           linkID=2
  41.     surface     spot2           linkID=2
  42.     surface     spot3           linkID=2   # adjoin spot
  43.     surface     spot4           linkID=2
  44.     surface     spot5           linkID=2
  45.     surface     spot6           linkID=2
  46.     surface     spot7           linkID=2
  47.     surface     spot8           linkID=2
  48.     surface     spot9           linkID=2
  49.     surface     spot10          linkID=2
  50.     
  51.     surface     slot
  52.     surface     surf_Door0      linkID=1
  53.     
  54.     sector      doorSec         
  55.         
  56.     template    tikiMove=tikikeymove            local
  57.     
  58.     keyframe    inReach=in_pickup.key            local
  59.     
  60.     # ** wrong spot lines **
  61.     sound        in_WrongSpot0=Inxj093.wav        local # Good idea...
  62.     sound        in_WrongSpot1=Inxj094.wav        local # Perfect world...but not this one
  63.     sound        in_WrongSpot2=Inxj095.wav        local # Must be a different way
  64.     sound        in_WrongSpot3=Inxj092.wav        local # Hmm, didn't quite work
  65.     
  66.     # ** using the wrong or no item lines (whichLine = 1) **
  67.     sound        in_WrongLine0=Inxj089.wav       local # That didn't work-->in_sayline[11]
  68.     sound        in_WrongLine1=Inxj090.wav        local # ...something wrong.
  69.     sound        in_WrongLine2=Inxj092.wav        local # Hmm...didn't quite work.
  70.     sound        in_WrongLine3=Inxj060.wav        local # I don't think...right answer
  71.     sound        in_WrongLine4=Inxj091.wav        local # Of course that didn't work.
  72.     
  73.     # ** locked door lines (whichLine = 2) **
  74.     sound        in_DoorLocked0=Inxj081.wav        local # Oh no...why...always locked?
  75.     sound       in_DoorLocked1=Inxj076.wav      local # This door is locked
  76.     sound       in_DoorLocked2=Inxj077.wav      local # it's locked
  77.     sound        in_DoorLocked3=Inxj078.wav        local # Locked.
  78.     sound        in_DoorLocked4=Inxj080.wav        local # Locked...luck never changes.
  79.     
  80.     # ** misc voice lines **
  81.     sound       inFits=Inxj109.wav              local   # it fits
  82.     sound       in_Stubby=Tm03j04.wav           local   # this door has stubby little...
  83.     
  84.     # ** sound fx **
  85.     sound       sndRotate=tem_tikikeymove_rotate_c.wav  local
  86.     sound       snd_Lava=gen_lava_flow_a.wav            local
  87.     
  88.     # ** music **
  89.     sound       mus_AweInspiring=mus_lag_uwatertemple.wav   local
  90.     
  91.     cog         mazeBubbles
  92.     cog         MM2BAAmbients
  93.     cog         cog_Hint
  94.     
  95.     vector      cave1               local
  96.     vector      blue                local
  97.     
  98.     # ** subroutines **
  99.     flex        opendoor            local
  100.     flex        wrongSpot           local
  101.     flex        firstSpeak          local
  102.     flex        speak               local
  103.         
  104.     int         tikiTurned=0        local
  105.     int         open=0              local
  106.     int         spot=0              local
  107.     int         tikiDown=0          local
  108.     int         playing=0           local
  109.     int         firstTime=0         local
  110.     int         firstVisit=1        local
  111.     
  112.     int         curCam              local
  113.     int         curItem             local
  114.     int         whichLine           local
  115.     int         lavaChannel         local
  116.     
  117.     int         newComment          local
  118.     int         oldComment          local
  119.     
  120. end
  121.  
  122. # ========================================================================================
  123.  
  124. code
  125.  
  126. startup:
  127.  
  128.     player = GetLocalPlayerThing();
  129.     SectorAdjoins(doorSec, 0);
  130.     SetThingLight(door, '0.35 0.3 0.2', 0.001, 0.1);
  131.     cave1 = VectorSet(0.10, 0.10, 0.10);    # canned in favor of blue (for now)
  132.     blue = VectorSet(0.50, 0.50, 0.60);
  133.     
  134.     # hide the stupid monkey so we can't hear him from MM
  135.     SetThingFlags(t_Monkey, 0x80000);
  136.     
  137.     return;
  138.         
  139. # ========================================================================================
  140.  
  141. entered:
  142.  
  143.     if(GetSenderID() == 2)
  144.     {
  145.         Print("spot = 1");
  146.         spot = 1;
  147.     }
  148.         
  149.     return;
  150.  
  151. # ========================================================================================
  152.  
  153. exited:
  154.  
  155.     if((GetSenderID() == 2) && (GetSourceRef() == player)) 
  156.     {
  157.         Print("spot = 0");
  158.         spot = 0;
  159.     }
  160.         
  161.     return;
  162.     
  163. # ========================================================================================
  164.  
  165. activated:
  166.     
  167.     curCam = GetCurrentCamera();
  168.     curItem = GetCurItem(player);
  169.  
  170.     if((GetSenderID() == 1) && (tikiDown == 0) && (playing == 0))
  171.     {
  172.         if(spot == 1)
  173.         {
  174.             # first visit to door and is not using tiki key
  175.             if((firstVisit == 1) && (curItem != 53))
  176.             {
  177.                 firstVisit = 0;
  178.                 playing = 1;
  179.                 Call firstSpeak;
  180.             }
  181.         
  182.             # player uses tiki key in correct spot
  183.             else if(curItem == 53)
  184.             {
  185.                 tikiDown = 1;
  186.                 Call openDoor;
  187.             }
  188.             
  189.             # player doesn't have or isn't using tiki key
  190.             else if(curItem == 0)
  191.             {
  192.                 playing = 1;
  193.                 whichLine = 2;
  194.                 Call speak;
  195.                 whichLine = 0;
  196.             }
  197.                 
  198.             # player is using something other than tiki key
  199.             else
  200.             {
  201.                 playing = 1;
  202.                 whichLine = 1;
  203.                 Call speak;
  204.                 whichLine = 0;
  205.             }
  206.         }
  207.         
  208.         # player is standing in the wrong spot
  209.         else if(spot == 0)
  210.         {
  211.             # first visit to door
  212.             if((firstVisit == 1) && (curItem != 53))
  213.             {
  214.                 firstVisit = 0;
  215.                 playing = 1;
  216.                 Call firstSpeak;
  217.             }
  218.             
  219.             # player is using tiki key in wrong spot
  220.             else if(curItem == 53)
  221.             {
  222.                 playing = 1;
  223.                 Call wrongSpot;
  224.             }
  225.             
  226.             # player doesn't have or isn't using tiki key
  227.             else if(curItem == 0)
  228.             {
  229.                 playing = 1;
  230.                 whichLine = 2;
  231.                 Call speak;
  232.                 whichLine = 0;
  233.             }
  234.                 
  235.             # player is using something other than tiki key
  236.             else
  237.             {
  238.                 playing = 1;
  239.                 whichLine = 1;
  240.                 Call speak;
  241.                 whichLine = 0;
  242.             }
  243.         }
  244.     }
  245.         
  246.     return;
  247.         
  248. # ========================================================================================
  249.  
  250. openDoor:
  251.  
  252.     Print("the tiki has landed");
  253.     
  254.     # solve hint 11
  255.     SendMessage(cog_Hint, user0);
  256.     
  257.     # show the monkey
  258.     ClearThingFlags(t_Monkey, 0x80000);
  259.     
  260.     # do cutscene stuff
  261.     MakeMeStop();
  262.     StartCutscene(2);
  263.     
  264.     # put away any weapon
  265.     DeselectWeaponWait(player);
  266.     
  267.     # cut to cam 2 and watch door open
  268.     SetCameraFocus(2, camera);
  269.     SetCameraSecondaryFocus(2, camTarget);
  270.     SetCurrentCamera(2);
  271.     
  272.     # outfit indy actor
  273.     CopyPlayerHolsters(player, indy);
  274.     
  275.     # hide player, show indy
  276.     SetThingFlags(player, 0x80000);
  277.     ClearThingFlags(indy, 0x80000);
  278.     
  279.     # remove tiki from inventory
  280.     ChangeInv(player, 53, -1);
  281.     
  282.     # mark slot adjoin as move so tiki will slide
  283.     SetAdjoinFlags(slot, 2);         # move
  284.     SetAdjoinFlags(spot3, 2);        # move
  285.     SetAdjoinFlags(spot5, 2);        # move
  286.     
  287.     # put tiki1 down and create it
  288.     PlayKey(indy, inReach, 4, 0x12, 0);
  289.     Sleep(1.0);
  290.     tiki = CreateThing(tikiMove, tiki1Ghost);
  291.     CaptureThing(tiki);
  292.     Sleep(0.2);
  293.     PlaySoundLocal(inFits, 1.0, 0.0, 0x0, 1);
  294.     
  295.     Sleep(0.5);
  296.     
  297.     # play music cue
  298.     PlaySoundLocal(mus_AweInspiring, 1.0, 0.0, 0x0, 0);
  299.     
  300.     Sleep(0.5);
  301.     
  302.     # rotate the tiki's
  303.     Rotate(tiki, -90, 1, 2.0);
  304.     PlaySoundThing(sndRotate, tiki, 1.0, 5.0, 10.0, 0x0);
  305.     WaitForStop(tiki);
  306.     
  307.     # change fog values
  308.     SetFog(1, blue, 40, 350);
  309.     
  310.     # clear adjoin stuff
  311.     SectorAdjoins(doorSec, 1);
  312.     SetAdjoinFlags(surf_Door0, 2);   # move
  313.     Sleep(0.1);
  314.     
  315.     # open the door
  316.     MoveToFrame(tiki, 1, 1.0);
  317.     MoveToFrame(door, 1, 1.0);
  318.     WaitForStop(door);
  319.     
  320.     # sends message to spider_wall's class cog, saying "user0" (27)
  321.     SendMessageEx(GetThingClassCog(spider0), 27, spider0, 0, 0, 0);
  322.     SendMessageEx(GetThingClassCog(spider1), 27, spider1, 0, 0, 0);
  323.     
  324.     ClearAdjoinFlags(slot, 2);      # no move
  325.     ClearAdjoinFlags(spot3, 2);     # no move
  326.     ClearAdjoinFlags(spot5, 2);     # no move
  327.     
  328.     # walk indy to tiki
  329.     AISetMoveSpeed(indy, 1.2);
  330.     AISetLookThing(indy, target1);
  331.     AISetMoveThing(indy, target1, 1);
  332.     Sleep(0.5);
  333.     
  334.     # pick up the tiki
  335.     PlayKey(indy, inReach, 4, 0x12, 0);
  336.     Sleep(1.0);
  337.     DestroyThing(tiki);
  338.     
  339.     # add tiki1 back into inventory
  340.     SetInvAvailable(player, 53, 1);
  341.     ChangeInv(player, 53, 1.0);
  342.     JonesInvItemChanged(53);
  343.     Sleep(0.5);
  344.     
  345.     # walk to the door
  346.     AISetLookThing(indy, target2);
  347.     AISetMoveThing(indy, target2, 1);
  348.     Sleep(0.5);
  349.     
  350.     # add ambient sound
  351.     lavaChannel = PlaySoundThing(snd_Lava, door, 1.0, 5.0, 10.0, 0x0001);
  352.     
  353.     # change fog and switch cameras
  354.     SetFog(1, '0.50 0.05 0.05', 70, 150);
  355.     SetCameraFocus(2, camera2);
  356.     SetCameraSecondaryFocus(2, indy);
  357.     
  358.     # walk to other side of door
  359.     AISetLookThing(indy, target3);
  360.     AISetMoveThing(indy, target3, 1);
  361.     
  362.     # close door behind indy
  363.     MoveToFrame(door, 0, 1.0);
  364.     WaitForStop(door);
  365.     
  366.     # turn off ambient sound
  367.     StopSound(lavaChannel, 0.0);
  368.     
  369.     # turn off melt maze bubbles
  370.     SendMessage(mazeBubbles, user0);
  371.     
  372.     # turn on MM2BA ambients
  373.     SendMessage(MM2BAAmbients, user0);
  374.     
  375.     # block adjoin
  376.     SectorAdjoins(doorSec, 0);
  377.     
  378.     # change fog again
  379.     SetFog(1, blue, 10, 350);
  380.     
  381.     # change door color
  382.     SetThingLight(door, '0.3 0.3 0.2', 0.001, 0.1);
  383.     
  384.     # move player into position
  385.     CopyOrientAndPos(indy, player);
  386.     
  387.     # hide indy show player
  388.     SetThingFlags(indy, 0x80000);
  389.     ClearThingFlags(player, 0x80000);
  390.     
  391.     # return camera to normal
  392.     SetCurrentCamera(curCam);
  393.     
  394.     # restore controls
  395.     ClearActorFlags(player, 0x200000);
  396.     EndCutscene();
  397.     
  398.     return;
  399.     
  400. # ========================================================================================
  401.  
  402. wrongSpot:
  403.  
  404.     # do cutscene stuff
  405.     MakeMeStop();
  406.     StartCutscene(0);
  407.     
  408.     # move ext cam around player
  409.     SetExtCamOffsetToThing(spot0Offset);
  410.     
  411.     # put away any weapon
  412.     DeselectWeaponWait(player);
  413.     
  414.     # nudge door
  415.     PlayMode(player, 60, 0);
  416.     Sleep(0.3);
  417.     
  418.     # say voice line
  419.     PlayVoice(player, in_WrongSpot0[RandBetween(0, 3)], 1.0, 1);
  420.     
  421.     # return camera to normal
  422.     RestoreExtCam();
  423.     
  424.     # restore controls
  425.     ClearActorFlags(player, 0x200000);
  426.     EndCutscene();
  427.     
  428.     playing = 0;
  429.     
  430.     return;
  431.     
  432. # ========================================================================================
  433.  
  434. firstSpeak:
  435.  
  436.     Print("firstVisit");
  437.             
  438.     # do cutscene stuff
  439.     MakeMeStop();
  440.     StartCutscene(0);
  441.     
  442.     # move ext cam around player
  443.     if(spot == 1) SetExtCamOffsetToThing(spot1Offset);
  444.     
  445.     else SetExtCamOffsetToThing(spot0Offset);
  446.     
  447.     # put away any weapon
  448.     DeselectWeaponWait(player);
  449.     
  450.     PlayMode(player, 60, 0);
  451.     Sleep(0.3);
  452.     
  453.     # say voice line
  454.     PlayVoice(player, in_Stubby, 1.0, 1);
  455.     
  456.     # return camera to normal
  457.     RestoreExtCam();
  458.     
  459.     # restore controls
  460.     ClearActorFlags(player, 0x200000);
  461.     EndCutscene();
  462.     
  463.     playing = 0;
  464.     
  465.     return;
  466.     
  467. # ========================================================================================
  468.  
  469. speak:
  470.  
  471.     while (newComment == oldComment) 
  472.     {
  473.         newComment = RandBetween(0, 4);
  474.     }
  475.     
  476.     oldComment = newComment;
  477.     
  478.     # do cutscene stuff
  479.     MakeMeStop();
  480.     StartCutscene(0);
  481.     
  482.     # move ext cam around player
  483.     if(spot == 1) SetExtCamOffsetToThing(spot1Offset);
  484.     
  485.     else SetExtCamOffsetToThing(spot0Offset);
  486.     
  487.     # put away any weapon
  488.     DeselectWeaponWait(player);
  489.     
  490.     PlayMode(player, 60, 0);
  491.     Sleep(0.3);
  492.     
  493.     if(whichLine == 1)
  494.     {
  495.         PlayVoice(player, in_WrongLine0[newComment], 1.0, 1);
  496.     }
  497.     
  498.     else if(whichLine == 2)
  499.     {
  500.         PlayVoice(player, in_DoorLocked0[newComment], 1.0, 1);
  501.     }
  502.     
  503.     # return camera to normal
  504.     RestoreExtCam();
  505.     
  506.     # restore controls
  507.     ClearActorFlags(player, 0x200000);
  508.     EndCutscene();
  509.     
  510.     playing = 0;
  511.     
  512.     return;
  513.     
  514. # ========================================================================================
  515.  
  516. end
  517.  
  518.